package com.sjdang.springcloud.learning.controller;

import javax.annotation.Resource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
@RequestMapping("/learning/nacos/consumer")
public class NacosConsumerController {
	
	private Logger log = LoggerFactory.getLogger(this.getClass());
	
	@Resource
	private RestTemplate restTemplate;
	
	@GetMapping("/hello")
	public String sayHello() {
		log.info("nacos-consumer is called  ");
		return restTemplate.getForObject("http://nacos-provider/learning/nacos/provider/hello", String.class);
	}

}
